package uk.org.landeg.euler.problems;

import uk.org.landeg.euler.problems.framework.AbstractProblem;
import uk.org.landeg.euler.problems.framework.ProblemLauncher;
import uk.org.landeg.euler.problems.lib.NumbersLib;

public class Problem006 extends AbstractProblem {
	public static void main(String[] args) {
		ProblemLauncher launcher = new ProblemLauncher(new Problem006());
		launcher.solve();
	}

	@Override
	public String getDescription() {
		return "Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.";
	}

	@Override
	public Integer getProblemNumber() {
		// TODO Auto-generated method stub
		return 6;
	}

	@Override
	public Object solve() {
		notes.add("use analytic approach using summation of sequence and tetrahedral numbers");
		long squareOfSums =(long) Math.pow(NumbersLib.sumRange(1, 100), 2);
		notes.add("squareOfSums = " + squareOfSums);
		long sumOfSquares = NumbersLib.tetrahedralNumber(100);
		notes.add("sumOfSquares = " + sumOfSquares);
		return Math.abs(sumOfSquares - squareOfSums);
	}
}
